package com.aaa.behind.controller;


import com.aaa.behind.service.IGDepositService;
import com.aaa.entity.GDeposit;
import com.aaa.util.PageInfo;
import com.aaa.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 保存方式 前端控制器
 * </p>
 *
 * @author whj
 * @since 2023-01-30
 */
@RestController
@RequestMapping("/g-deposit")
public class GDepositController {

    @Autowired
    private IGDepositService igDepositService;

    @PostMapping("findDepositByCondition")
    public Result findDepositByCondition(@ModelAttribute PageInfo pageInfo, GDeposit gDeposit){
        return new Result(igDepositService.findDepositByCondition(pageInfo,gDeposit));
    }

    @PostMapping("findAllDeposit")
    public Result findAllDeposit(){
        return new Result(igDepositService.findAllDeposit());
    }

    @PostMapping("updateStatus")
    public Result updateStatus(GDeposit gDeposit){
        return new Result(igDepositService.updateById(gDeposit));
    }

    @PostMapping("deleteDeposit")
    public Result deleteDeposit(Integer id){
        return new Result(igDepositService.removeById(id));
    }
}

